﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;


namespace Kinductor.Views
{
    /// <summary>
    /// Interaction logic for SheetMusic.xaml
    /// </summary>
    public partial class SheetMusic : UserControl
    {

        public int Position { set {SetPosition(value);} }
        private uint backwardsPos = 0;

        public SheetMusic()
        {
            InitializeComponent();
        }

        private void SetPosition(int position) {
            if(position == 0){
                Canvas.SetLeft(stackPanel, 0);
                backwardsPos = 0;
            }
            if (position/5 < 500)
            {
                Canvas.SetLeft(marker, Convert.ToInt16(position / 6.95));
            }
            else { 
                backwardsPos++;
                Canvas.SetLeft(stackPanel, (backwardsPos / 6.95) * -1);
            }
        }
    }
}